/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 *                    _______    _                                     *
 *                   (  ____ \  ( \     |\     /|                      * 
 *                   | (    \/  | (     ( \   / )                      *
 *                   | (__      | |      \ (_) /                       *
 *                   |  __)     | |       \   /                        *
 *                   | (        | |        ) (                         *
 *                   | )        | (____/\  | |                         *
 *                   |/         (_______/  \_/                         *
 *                                                                     *
 *                                                                     *
 *     eyas is an awesome c++11 network library.                       *
 *                                                                     *
 *   @author: xiyin zhang                                              *
 *   @email: zhangxiyin6950@163.com                                    *
 *   @date: 2016-04-24                                                 *
 *                                                                     *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifndef EYAS_BASE_SINGLETON_H_
#define EYAS_BASE_SINGLETON_H_

namespace eyas {
namespace basic {

template<typename T>
class singleton
{
public:
    static T* instance();

    //template<int no>
    //static T* instance_ex();
protected:
	singleton(){}
};

template<typename T>
inline T* singleton<T>::instance()
{
    static T instance;

    return &instance;
}
//template<typename T>
//template<int no>
//T* singleton<T>::instance_ex()
//{
//    static T instance;
//    return &instance;
//}

//template<typename T>
//T *singleton(){
//    static T instance;
//    return &instance;
//}
//template<typename T, int no>
//T *singleton_ex(){
//    static T instance;
//    return &instance;
//}

}
}

#endif
